<!DOCTYPE html>
<html>
<head>
<title>小样来吧冠军</title>
<meta http-equiv="pragma" content="no-cache">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="http://tjs.sjs.sinajs.cn/open/thirdpart/js/jsapi/mobile.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx}/resource/css/reset.css?20160608">
<link rel="stylesheet" type="text/css" href="${ctx}/resource/css/style.css?20160608">
<link rel="stylesheet" type="text/css" href="${ctx}/resource/css/football.css?20160608">
<script type="text/javascript" src="${ctx}/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="${ctx}/resource/js/app.js"></script>
<script type="text/javascript" src="${ctx}/resource/js/jquery.cookie.js"></script>
<script type="text/javascript" src="${ctx}/resource/js/autosize.min.js"></script>
<script type="text/javascript" src="${ctx}/resource/js/cnzz.js"></script>
</head>
<body id="index">
  <div class="page">
    <div class="content">
        <img src="${ctx}/resource/images/banner.png" class="banner">
        
      <div class="wrap">
      <div class="info">
      <#if championUser??>
          <div class="coins">我的活力币：<span id="myEnergyCurrency">${championUser.energy_currency!}</span></div>
          <#else>
          <div class="coins">我的活力币：<span id="myEnergyCurrency">0</span></div>
          </#if>
        </div>  
            <ul class="main-menu">
              <li onclick="dialog('.desc')">
                <img src="${ctx}/resource/images/index/desc_btn_1.png" alt="">
              </li>
              <li>
                <img src="${ctx}/resource/images/index/start_win.png" alt="" onclick="forwardAddCurrency()">
              </li>
            </ul>
            <!-- 滚动文字 -->
          <div class="carousel clearfix">
            <img src="${ctx}/resource/images/index/star.png" class="star">
            <span>小样明星冠军榜，为偶像加活力，抢1万朵免费鲜花，助力偶像荣登微博明星势力榜</span>
          </div>
            <!-- 签到 -->
            <div class="qd" id="sign">
              
                <!-- 签到按钮 -->
                <#if currday_sign == '0' >
                <div class="qd_btn" onclick="clickSign()">
                <img src="${ctx}/resource/images/index/qd_btn.png">
                </div> 
                <#else>
                <div class="qd_btn" >
                <img src="${ctx}/resource/images/index/qd_btn_gray.png">
                </div> 
                </#if>
              
              <div class="desc">
                <h3>已连续签到<span>${signCount!}</span>天</h3>
                <p>连续签到，获相应天数活力币</p>
              </div>
            </div>
            
             <!-- 同步 -->
            <div class="tb" id="tb">
                <!-- 同步按钮 -->
                <#if currday_sync == '0' >
                <div class="tb_btn" onclick="getWbRun()">
                <img src="${ctx}/resource/images/index/tb_btn.png">
                </div> 
                <#else>
                <div class="tb_btn">
                <img src="${ctx}/resource/images/index/tb_btn_gray.png">
                </div> 
                </#if>
              
              <div class="desc">
                我的微博运动记录
              </div>
            </div>
             <div class="exchange">
              <div class="center">
                <h2>我的步数</h2>
                 <#if championUser??>
                 <h1 id="step_number">${championUser.step_number!}</h1>
          <#else>
          <h1 id="step_number">0</h1>
          </#if>
                
                <p>可兑换<br><span id="chang_currency">${chang_currency!}</span>个活力币</p>
              </div>
              <div class="footer">
                <div class="btn">
                  <img src="${ctx}/resource/images/index/exchange_btn.png" class="exchange_btn" onclick="exchangeCurrency()"> <!-- 换活力币按钮 -->
                </div>
              </div>
            </div>
            <!-- <div class="menu">
          <ul>
            <li><a href="#football_banner" class="anchor">竞猜</a></li>
            <li><a href="#s_champions" class="anchor">冠军榜</a></li>
             <li><a href="#s_gambling" class="anchor">拼手气</a></li>
              <li><a href="#s_game" class="anchor">小游戏</a></li>
              <li><a href="#s_ly" class="anchor">留言</a></li>
             <li><a href="#index" class="anchor">顶部</a></li>
            </ul>
           <div class="trigger">menu</div>
          </div> -->
            <!-- 周末竞猜 -->
            <img src="${ctx}/resource/images/index/guess_banner.png" class="sec-banner" id="guess_banner">
            <#if championCompetition ??> 
            <div class="vs clearfix" id="s_vs">
					<#if championUserGuessing ??>
					<#if championUserGuessing.team_type == '01'> 
					<#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '01' >
					 <a>
						<div class="left won" id="home_team" >
					<#else>
						<a>
						<div class="left chosed" id="home_team" >
					</#if>
					<#else> 
					    <a>
						<div class="left chosed" id="home_team" >
					</#if>
					<#else> 
					   <#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '01' > 
					    <a>
						<div class="left won" id="home_team" >
					<#else>
						<a>
						<div class="left" id="home_team" >
					</#if>
					<#else> 
					    <a>
						<div class="left" id="home_team" >
					</#if>
					</#if> 
					<#else> 
					<#if championCompetition.competition_status == '01' && championCompetition.is_guess == '1' > 
					    <a onclick="selectTeam('${championCompetition.home_team!}','01','${championCompetition.home_odds!}');">
					<#else> 
					    <a> 
					</#if> 
					<#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '01' >
						<div class="left won" id="home_team" >   
					<#else>
						<div class="left " id="home_team" >
																	
					</#if> 
					<#else>
						<div class="left " id="home_team" >
																		
					</#if>
					</#if>
						<div class="pic" style="background-image: url('${server_uri!}${championCompetition.home_team_pic!}');"></div>
						<img src="${ctx}/resource/images/vs/team_star.png">
						<div class="ratio">回报率${championCompetition.home_odds!}</div>
						<div class="cover"></div>
					<#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '01' >
						<div class="win-cover"> <img src="${ctx}/resource/images/vs/win.png">
						<div class="ratio">回报率${championCompetition.home_odds!}</div>
						</div>
					</#if> 
					</#if>
					
						</div>
						</a>
              <div class="center">
                <img src="${ctx}/resource/images/vs/center.png">
              </div>
              </#if> 
              <#if championCompetition ??> 
					<#if championUserGuessing ??> 
					<#if championUserGuessing.team_type == '02'> 
					<#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '02' > 
					    <a>
						<div class="right won" id="visit_team">
																
					<#else> 
					    <a>
						<div class="right chosed" id="visit_team">
																		
					</#if> 
					<#else> 
					    <a>
						<div class="right chosed" id="visit_team">
					</#if> 
					<#else> 
					<#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '02' > 
					    <a>
						<div class="right won" id="visit_team">
					<#else> 
					    <a>
						<div class="right " id="visit_team">
					</#if> 
					<#else> 
					    <a>
						<div class="right " id="visit_team">
					</#if> 
					</#if> 
					<#else> 
					<#if championCompetition.competition_status == '01' && championCompetition.is_guess == '1'> 
					    <a onclick="selectTeam('${championCompetition.visiting_team!}','02','${championCompetition.visiting_odds!}');">
					<#else> 
					    <a> 
					</#if> 
					<#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '02' >
						<div class="right won" id="visit_team">
					<#else>
						<div class="right " id="visit_team">
					</#if> 
					<#else>
						<div class="right " id="visit_team">
					</#if>
					</#if>
						<div class="pic" style="background-image: url('${server_uri!}${championCompetition.visiting_team_pic!}');"></div>
						<img src="${ctx}/resource/images/vs/team_champian.png">
						<div class="ratio">回报率${championCompetition.visiting_odds!}</div>
						<div class="cover"></div>
					<#if championCompetition.winner ?? > 
					<#if championCompetition.winner == '02' >
						<div class="win-cover">
						<img src="${ctx}/resource/images/vs/win.png">
						<div class="ratio">回报率${championCompetition.visiting_odds!}</div>
						</div>
					</#if> 
					</#if>
						</div>
						</a> 
					</#if>
					<div class="menu">
          <ul>
            <li><a href="#guess_banner" class="anchor">竞猜</a></li>
            <li><a href="#football_banner" class="anchor">欧洲杯竞猜</a></li>
             <li><a href="#s_gambling" class="anchor">拼手气</a></li>
              <li><a href="#s_game" class="anchor">小游戏</a></li>
              <li><a href="#s_ly" class="anchor">留言</a></li>
             <li><a href="#index" class="anchor">顶部</a></li>
            </ul>
           <div class="trigger">menu</div>
          </div>

            </div>
           
            <p class="vs-desc">明星队每获得1个锦囊，回报率就加1</p>
            <div class="countdown" id="count_down">
                                  截至投票时间：0 天 00 时 00 分 00 秒
            </div>
            <#if championCompetition ?? >
					<#if championUserGuessing ??>
					<div class="vs-change">
					<div class="supp">
					    <div class="bar disabled" id="submit_currency"><input type="number" disabled="true" value="${championUserGuessing.pay_currency!}"/></div>
					    <div class="btn" id="vs_button"><img src="${ctx}/resource/images/index/vs_btn_gray.png"></div>
                        </div>
                        <#if expect_energy_currency ?? >
                        	<#if championCompetition.competition_status=='01'||championCompetition.competition_status=='02'>
                        	<div class="result-bar" id="expect_currency" ><span>${expect_energy_currency!}</span></div>
                        	<#else>
	                        	<#if championCompetition.winner==championUserGuessing.team_type>
	                        	<div class="result-bar disabled" id="expect_currency" ><span>${expect_energy_currency!}</span></div>
	                        	<#else>
	                        	<div class="result-bar disabled" id="expect_currency" ><span>0</span></div>
	                        	</#if>
                        	</#if>
                        <#else>
                        <div class="result-bar" id="expect_currency" ><span></span></div>
                        </#if>
                    </div>
					<#else> 
					<#if championCompetition.is_guess == '1' && championCompetition.competition_status=='01'>
					<div class="vs-change">
					<div class="supp">
					    <div class="bar" id="submit_currency"><input type="tel" id="pay_num" placeholder="点击输入"/></div>
					    <div class="btn" id="vs_button"><img src="${ctx}/resource/images/index/vs_btn.png" onclick="submitSguess('${championCompetition.id!}')"></div>
                        </div>
                        <div class="result-bar" id="expect_currency"><span></span></div>
                        </div>
                        <#else>
                    <div class="vs-change">
					<div class="supp">
					    <div class="bar disabled" id="submit_currency"><input type="tel" id="pay_num" placeholder="点击输入" readonly /></div>
					    <div class="btn" id="vs_button"><img src="${ctx}/resource/images/index/vs_btn_gray.png"></div>
                        </div>
                        <div class="result-bar" id="expect_currency"><span></span></div>
                        </div>
                        </#if>
						</#if> 
						<#else> 
						<#if championCompetition.competition_status == '04'>
						<#if championUserGuessing ??>
						<div class="vs-change">
						<div class="supp">
					    <div class="bar disabled" id="submit_currency"><input type="number" disabled="true" value="${championUserGuessing.pay_currency!}"/>
					    </div>
					    <div class="btn" id="vs_button" ><img src="${ctx}/resource/images/index/vs_btn_gray.png"></div>
					    </div>
                        <div class="result-bar disabled" id="expect_currency"><span>${championUserGuessing.win_currency!}</span></div>
                        </div>
					    </#if> 
					    <#else>
					    <#if championUserGuessing ??>
						<div class="vs-change">
						<div class="supp">
					    <div class="bar disabled" id="submit_currency"><input type="number" disabled="true" value="${championUserGuessing.pay_currency!}"/>
					    </div>
					    <div class="btn" id="vs_button"><img src="${ctx}/resource/images/index/vs_btn_gray.png"></div>
					    </div>
                        <#if expect_energy_currency ?? >
                           <div class="result-bar disabled" id="expect_currency"><span>${expect_energy_currency!}</span></div>
                        <#else>
                        <div class="result-bar" id="expect_currency"></div>
                        </#if>
                        </div>
					    </#if> 
					    </#if> 
					</#if>
					<!-- 欧洲杯 -->
                    <img src="${ctx}/resource/images/football/ban.png" class="sec-banner" id="football_banner">
                        <div class="football clearfix" id="s_football">
                     <button onclick="forwardEuropeGuessing()" >竞猜</button>  
                     </div>
            <!-- 兑换 -->
            <img src="${ctx}/resource/images/index/gambling_banner.png" class="sec-banner" id="s_gambling">
            <div class="gambling-entries">
              <div class="et1" onclick="forwardTurntable();"><button>兑换</button></div>
              <div class="et2" onclick="forwardPocket();"><button>兑换</button></div>
              <div class="et3" onclick="getChampionPrizes();"><button>兑换</button></div>
            </div>
            <!-- 小游戏 -->
             <img src="${ctx}/resource/images/index/game_banner.png" class="sec-banner"  id="s_game">
            <div class="game-entries">
              <div class="et1" onclick="forwardKp()" ></div>
              <div class="et2" onclick="forwardShake()"></div>
            </div>
            <!--战绩排行 -->
            <div class="ranking">
              <header class="clearfix">
                <div class="title">战绩排行</div>
                <ul class="clearfix">
                  <li class="pill active" id="energy_rank" onclick="getRank('1')">活力币</li><!--
               --><li class="pill " id="wb_rank" onclick="getRank('2')">微博运动</li><!--
               --><li class="pill" id="pk_rank" onclick="getRank('3')">小样微跑</li>
                </ul>
              </header>
              <div class="body">
                <ul class="rank-body" id="championship">
                  <!-- 列表 -->
                </ul>
                <div id="morePage">
                <#if championUserPageNumber lt championUserTotalPage>
                <p id="more_page" onclick="nextPage(${championUserPageNumber!}); return false;">点击加载更多...</p>
                </#if>
                </div>
              </div>
              
            </div>
            <div class="ly" id="s_ly">
          <header class="clearfix">
                        留言板
          </header>
          <div class="body">
            <ul id="message">
            </ul>
          </div>
          <footer>
            <img src="${ctx}/resource/images/index/ly_btn.png" onclick="messageSubmit()">
            <input type="text" id="messageText">
          </footer>
        </div>
        <img src="${ctx}/resource/images/index/logo.png" class="logo-foot">
        </div>
      </div>
      <!-- 签到确认 -->
      <div class="dialog qd-confirm">
      <div class="d-top"> 
      <img src="${ctx}/resource/images/index/d-head.png?2">
      </div>
        <div class="d-body">
          <textarea>我在参与#来吧冠军#小样乳酸盐杯·全民冠军赛，每天签到成功可赢活力币，兑换由小样君提供的丰厚大礼，奖品周周不同，有iwatch、蓝牙耳机、红包等等豪礼，小伙伴们快和我一起动起来吧！【H5链接】</textarea>
        </div>
        <div class="d-bottom">
        <img src="${ctx}/resource/images/index/qd_dialog_banner.png?2" class="qd_banner"> 
        <img src="${ctx}/resource/images/index/d-foot.png?2">
        </div>
        <div class="d-footer">
          <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn btns back" alt="" onclick="dialogClose()"> <!--返回按钮-->
          <img src="${ctx}/resource/images/index/dialog_btn_yes.png" class="btn btns yes" alt="" onclick="makeSign()"> <!--确认按钮-->
        </div>
      </div>

      <!-- 签到成功 -->
      <div class="dialog qd-success">
        <div class="d-body" id="qd-success-sign">
          <p>获得<span>01</span>个活力币</p>
        </div>
        <div class="d-footer">
          <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--返回按钮-->
        </div>
      </div>

      <!-- 签到失败 -->
      <div class="dialog qd-fail">
        <div class="d-body" id="qd-fail-sign">
        <p class="message">系统繁忙 请稍后再试</p>
        </div>
        <div class="d-footer">
          <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--返回按钮-->
        </div>
      </div>

      <!-- 兑换成功 -->
      <div class="dialog exchange-success">
        <div class="d-body" id="exchange-success-currency">
          <p>获得<span>0</span><span>1</span>个活力币</p>
        </div>
        <div class="d-footer">
          <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--返回按钮-->
        </div>
      </div>

      <!-- 兑换失败 -->
      <div class="dialog exchange-fail">
        <div class="d-body" id="exchange-fail-currency">
        <p class="message">系统繁忙 请稍后再试</p>
        </div>
        <div class="d-footer">
          <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--返回按钮-->
        </div>
      </div>
      <!-- 分享好友 -->
  <div class="dialog share">
    <div class="d-body">
      
    </div>
    <div class="d-footer">
      <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--发送按钮-->
    </div>
  </div>
      <!-- 欧洲杯弹窗 -->
<div class="dialog champ">
  <div class="d-body">
    <img src="${ctx}/resource/images/index/dialog_close.png" class="close"  onclick="dialogClose()">
  </div>
  <div class="d-footer">
    <img src="${ctx}/resource/images/index/join_btn.png" class="btn one back" onclick="forwardEuropeGuessing()"> <!--点击参与按钮-->
  </div>
</div>
      <!-- 提交成功 -->
	  <div class="dialog sub-success">
		<div class="d-body"></div>
			<div class="d-footer">
				<img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()">
																										<!--返回按钮-->
			</div>
	  </div>
      <div class="dialog desc">
    <div class="d-body">
    </div>
    <div class="d-footer">
      <img src="${ctx}/resource/images/index/dialog_btn_back.png" class="btn one back" alt="" onclick="dialogClose()"> <!--返回按钮-->
    </div>
  </div>
  </div>
  <div class="mask"></div>
</body>
<script type="text/javascript">
var step=0,ismessage=true;
var fromUser1=$.cookie('fromUser1');
var is_debug=false;
if(fromUser1 == "5144325993" || fromUser1 == "1353118650" ){
is_debug=true;
}
$(document).ready(function() { 
  //初始化微博js
$.ajax({
		type : "GET",
		url : "${ctx}/home/init",
		data : "reqUrl=" + window.location.origin + window.location.pathname
				+ window.location.search,
		async : false,		
		success : function(json) {
		
			window.WeiboJS.init({
				'appkey' : json.appId,
				'debug' : is_debug,
				'timestamp' : json.timestamp,
				'noncestr' : json.nonceStr,
				'signature' : json.signature,
				'callback' : json.callback,
				'scope' : [ 'getNetworkType', 'networkTypeChanged',
						'getBrowserInfo', 'checkAvailability',
						'setBrowserTitle', 'openMenu', 'setMenuItems',
						'menuItemSelected', 'setSharingContent', 'openImage',
						'scanQRCode', 'pickImage', 'getLocation',
						'pickContact', 'apiFromTheFuture','weiboRun' ]
			}, function(ret) {
			   if(JSON.stringify(ret.code) == 403 ){
			      data_code="1";
			     //window.location.href="${ctx}/home/forWardErrorHtml?open_type="+open_type;
			   }
			});
		}
	});
}); 
var oauthURL="${oauthURL!}";
var rank_type="1";
var open_type="";
var data_code="0";
var myName="";
dialog(".champ");
<#if championUser ?? >
myName=decodeURI("${championUser.user_name!}");
</#if>
var date=0,open_day=0,open_hour=0,open_minute=0,open_second=0,closeshowtime;
<#if championCompetition ?? >
date="${championCompetition.guess_second!}";
</#if>
 if(parseInt(date)>0){
        open_day=parseInt(date/86400);
        var rest_date=parseInt(date%86400);
        open_hour=parseInt(rest_date/3600);
        rest_date=parseInt(rest_date%3600);
		open_minute=parseInt(rest_date/60);
		open_second= parseInt(date%60);
		 openshowtime();
		closeshowtime=setInterval(function () {
                    openshowtime();
                }, 1000);
	}
	else{
		$("#count_down").html("竞猜时间每周六21:30--周日21:45");
	}
<#if championUserMessageList?? >
var htmlStr="<li>@我就是小样君：奖品是统一发放的，由于中奖人数很多，所以请大家耐心等待，多留意小样君官方微博内容以及私信</li>";
<#list championUserMessageList as c>
	 var user_name="${c.user_name!}";
	 user_name=decodeURI(user_name);
	 var user_message="${c.user_message!}";
	 user_message=decodeURI(user_message);
	 htmlStr+="<li>@"+user_name+" : "+user_message+"</li>";
</#list >
$("#message").html(htmlStr);	
</#if>
var htm="";
<#list championUserList as u>
 htm+="<li>";
 var rowNum="${u.rownum!}";
 htm+="<div class='index'><span>No."+rowNum+"</span></div>";
 htm+="<div class='avatar'><img src='${u.head_pic!}' alt=''></div>";
 var user_name="${u.user_name!}";
 if(user_name == null){
   user_name="";
 }
 user_name=decodeURI(user_name);
 htm+="<div class='name'><span>"+user_name+"</span></div>";
 htm+="<div class='step'><span>${u.energy_currency!}</span></div>";
 htm+="</li>";
</#list>
$("#championship").html(htm);

if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) 
{
		open_type="1";
	}else {
		open_type="2";
}


	//获取微博运动数据
	function getStep(data) {
	    step=JSON.stringify(data.data.step);
	    var stepArray=step.split(":");
	    step=stepArray[1];
	    step=step.substring(1,step.length-2);
	}
	WeiboJS.invoke("weiboRun", {}, getStep);
	
	//留言
	 function messageSubmit(){
	 statistics(); //cnzz统计
	 if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	 
	 	if(ismessage){
	 		ismessage=false;
	 		var messageText = $("#messageText").val();
			if (messageText == "") {
				var warningHtm = "<p class='message'>留言不能为空</p>";
				$("#exchange-fail-currency").html(warningHtm);
				dialog(".exchange-fail");
				ismessage=true;
				return;
			}
			$.ajax({type : "POST",url : "${ctx}/home/userMessage",async : false,data:{
				message : messageText,
				"content":"#来吧冠军##全民冠军时刻#我在小样乳酸盐杯·全民冠军赛的留言板中为冠军Idol带yan，我留言说：“用户留言内容”http://lbgj.fansiji.com/xyChampion/home/homePage?source=comments",
				"pic":"/alidata/server/tomcat-7.0.54/webapps/xyChampion/resource/images/index/qd_dialog_banner_1.jpg"
			}, success:function(json) {
				  if (json.code == 0) {
				  		$("#message").prepend("<li>@"+ myName +" : "+messageText+"</li>");
				  		$("#messageText").val("");
				  		ismessage=true;
				     // dialog(".sub-success");
				  } else {
				 	 	var msgHtm = "<p class='message'>" + json.msg + "</p>";
					 	$("#exchange-fail-currency").html(msgHtm);
					 	dialog(".exchange-fail");
					  	ismessage=true;
				  }
			   } 
		    });
	 	}
	}
	//签到
function clickSign(){
       statistics(); //cnzz统计
   if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	dialog('.qd-confirm');
	    }
	 function makeSign(){
	  dialogClose();
	$.ajax({type : "POST",url : "${ctx}/home/sign",async : false,data:{
	"content":"#来吧冠军# #全民冠军时刻#我在参与小样乳酸盐杯•全民冠军赛的签到活动，每天签到成功可赢活力币，连续签到可赢相应天数的活力币。我已坚持签到sign_day天，小伙伴们快来跟我来一起，挑战自我，做自己的冠军！http://lbgj.fansiji.com/xyChampion/home/homePage?source=sign",
	"pic":"/alidata/server/tomcat-7.0.54/webapps/xyChampion/resource/images/index/qd_dialog_banner_1.jpg"
	},success:function(json){
	       if(json.code == 0 ){
	       var htm = "";
	       htm+="<div class='qd_btn'>";
           htm+="<img src='${ctx}/resource/images/index/qd_btn_gray.png'>";
           htm+="</div>";
           htm+="<div class='desc'>";
           var signDay=${signCount!}+1;
           htm+="<h3>已连续签到<span>"+signDay+"</span>天</h3>";
           htm+="<p>连续签到，获相应天数活力币</p>";
           htm+="</div>";
	       $("#sign").html(htm);
	       $("#myEnergyCurrency").html(json.energy_currency);
	       var signMsg="<p>获得<span>"+signDay+"</span>个活力币</p>";
	       $("#qd-success-sign").html(signMsg);
	       dialog(".qd-success");
	       autosize.update($(".qd-confirm textarea"))
	       }else{
	       if(json.code == 404 ){
	            window.location.href=json.msg;
	       }else{
	           var msg="<p class='message'>"+json.msg+"</p>";
		       $("#qd-fail-sign").html(msg);
	           dialog(".qd-fail");
	           }
	           }
	       }
	    }); 
	}
	var team_id = "";
	var team_type = "";
	var team_odds = "";
	//选择战队
	function selectTeam(teamId, teamType, odds) {
	    
	    $("#visit_team").removeClass("chosed");
	    $("#home_team").removeClass("chosed");
	    if(teamType == '01'){
	    $("#home_team").addClass("chosed");
	    }else{
	    $("#visit_team").addClass("chosed");
	    }
	    
		team_id = teamId;
		team_type = teamType;
		team_odds = odds;
	}
	//提交竞猜
		function submitSguess(competition_id) {
		statistics(); //cnzz统计
		if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
		if (!team_id || !team_type || !team_odds) {
			var warningHtm = "<p class='message'>请选择一个队伍进行竞猜</p>";
			$("#exchange-fail-currency").html(warningHtm);
			dialog(".exchange-fail");
			return;
		}
		var currency_num = $("#pay_num").val();
		if (currency_num == "") {
			var warningHtm = "<p class='message'>活力币不能为空</p>";
			$("#exchange-fail-currency").html(warningHtm);
			dialog(".exchange-fail");
			return;
		}
		$.post("${ctx}/home/guessCompetition", {
			competition_id : competition_id,
			team_id : team_id,
			team_type : team_type,
			pay_odds : team_odds,
			pay_currency : currency_num
		}, function(data) {
			if (data.code == 0) {
			    $("#pay_num").attr("readonly","readonly");
			    $("#expect_currency").html("<span>"+data.callBackData.get_energy_currency+"</span>");
			    $("#myEnergyCurrency").html(data.callBackData.remain_energy_currency);
			    $("#submit_currency").addClass("disabled");
			    $("#vs_button").html("<img src='${ctx}/resource/images/index/vs_btn_gray.png'>");
			    
				dialog(".sub-success");
			} else {
				var msgHtm = "<p class='message'>" + data.msg + "</p>";
				$("#exchange-fail-currency").html(msgHtm);
				dialog(".exchange-fail");
			}
		});
	}
	function scrollDown() {
  var li_h = $(".rank-body li").height();
  $(".rank-body")[0].scrollTop += li_h / 2;
}
//获取排行榜分页
function nextPage(pnum){
statistics(); //cnzz统计
	$("#more_page").remove();
	scrollDown();
	$.post("${ctx}/home/getChampionship",{
		page:pnum+1,
		rank_type:rank_type,
		is_page:'0'
		},function(json){
			var htmStr="";
			var pageHtm="";
			var list=json.list;
			for(var i in list){
			             htmStr+="<li>";
						 htmStr+="<div class='index'><span>No."+list[i].rownum+"</span></div>";
						 if(!list[i].head_pic){
						    //htmStr+="<img src='' alt=''>";
						 }else{
						    htmStr+="<div class='avatar'><img src='"+list[i].head_pic+"' alt=''></div>";
						 }
						 
						 var user_name=list[i].user_name;
						 if(!user_name){
						   user_name="";
						 }else{
						 user_name=decodeURI(user_name);
						 }
						 htmStr+="<div class='name'><span>"+user_name+"</span></div>";
						 var energy_currency=list[i].energy_currency;
						 if(!energy_currency){
						  energy_currency="0";
						 }
						 if(rank_type == "1"){
						 htmStr+="<div class='step'><span>"+energy_currency+"</span></div>";
						 }
						  var step_number=list[i].step_number;
						 if(!step_number){
						  step_number="0";
						 }
						 if(rank_type == "2"){
						 htmStr+="<div class='step'><span>"+step_number+"</span></div>";
						 }
						  var one_cool_run=list[i].one_cool_run;
						 if(!one_cool_run){
						  one_cool_run="0";
						 }
						 if(rank_type == "3"){
						 htmStr+="<div class='step'><span>"+one_cool_run+"</span></div>";
						 }
						 htmStr+="</li>";
			}
			if(json.pageNumber < json.totalPage){
				pageHtm+="<p id='more_page' onclick='nextPage("+json.pageNumber+"); return false;'>点击加载更多...</p>";
			}
			$("#championship").append(htmStr);	
			$("#morePage").html(pageHtm);	
	},'json');
}
//排行榜切换
function getRank(type){
statistics(); //cnzz统计
rank_type=type;
  $("#more_page").remove();
  $("#energy_rank").removeClass("active");
  $("#wb_rank").removeClass("active");
  $("#pk_rank").removeClass("active");
  if(type == '1'){
    $("#energy_rank").addClass("active");
  }
  if(type == '2'){
    $("#wb_rank").addClass("active");
  }
  if(type == '3'){
    $("#pk_rank").addClass("active");
  }
	scrollDown();
	$.post("${ctx}/home/getChampionship",{
		page:1,
		rank_type:type,
		is_page:'0'
		},function(json){
			var htmStr="";
			var pageHtm="";
			var list=json.list;
			for(var i in list){
			             htmStr+="<li>";
						 htmStr+="<div class='index'><span>No."+list[i].rownum+"</span></div>";
						 if(!list[i].head_pic){
						    //htmStr+="<img src='' alt=''>";
						 }else{
						    htmStr+="<div class='avatar'><img src='"+list[i].head_pic+"' alt=''></div>";
						 }
						 
						 var user_name=list[i].user_name;
						 if(!user_name){
						   user_name="";
						 }else{
						 user_name=decodeURI(user_name);
						 }
						 htmStr+="<div class='name'><span>"+user_name+"</span></div>";
						 var energy_currency=list[i].energy_currency;
						 if(!energy_currency){
						  energy_currency="0";
						 }
						 if(rank_type == "1"){
						 htmStr+="<div class='step'><span>"+energy_currency+"</span></div>";
						 }
						  var step_number=list[i].step_number;
						 if(!step_number){
						  step_number="0";
						 }
						 if(rank_type == "2"){
						 htmStr+="<div class='step'><span>"+step_number+"</span></div>";
						 }
						  var one_cool_run=list[i].one_cool_run;
						 if(!one_cool_run){
						  one_cool_run="0";
						 }
						 if(rank_type == "3"){
						 htmStr+="<div class='step'><span>"+one_cool_run+"</span></div>";
						 }
						 htmStr+="</li>";
			}
			if(json.pageNumber < json.totalPage){
				pageHtm+="<p id='more_page' onclick='nextPage("+json.pageNumber+"); return false;'>点击加载更多...</p>";
			}
			$("#championship").html(htmStr);	
			$("#morePage").html(pageHtm);
				
	},'json');
}
//获取活力币记录
function currencyRecord(){
statistics(); //cnzz统计
if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	  window.location.href="${ctx}/home/getCurrencyEecord";
}
	function dialogSignClose(){
	  window.location.href="${ctx}/home/homePage";
	}
	//跳到转盘
	function forwardTurntable(){
	statistics(); //cnzz统计
	 if(fromUser1==null || fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	  window.location.href="${ctx}/home/forwardTurntable";
	}
	//跳转到红包
	function forwardPocket(){
	statistics(); //cnzz统计
	 if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	  window.location.href="${ctx}/home/forwardPocket";
	}
	//跳转到明星冠军榜
	function forwardAddCurrency(){
	statistics(); //cnzz统计
	 if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	  window.location.href="${ctx}/home/getStartList";
	}
	//跳转到欧洲杯赛事竞猜
	function forwardEuropeGuessing(){
	statistics(); //cnzz统计
	 if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	  window.location.href="${ctx}/home/forwardEuropeGuessing";
	}
	
	//奖品兑换
	function getChampionPrizes(){
	statistics(); //cnzz统计
	 if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	  window.location.href="${ctx}/home/getChampionPrizes";
	}
	//同步微博运动
	function getWbRun(){
	statistics(); //cnzz统计
	if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	   if(data_code=="1"){
       var msg="<p class='message'>请在微博客户端打开</p>";
		       $("#qd-fail-sign").html(msg);
	           dialog(".qd-fail");
	           return;
	           } 
			    $.post("${ctx}/home/getWbRun",{
			    "step":step
			    },function(json){
			       if(json.code == 0){
			       var htm="";
			       htm+="<div class='tb_btn'>";
                   htm+="<img src='${ctx}/resource/images/index/tb_btn_gray.png'>";
                   htm+="</div>";
                   htm+="<div class='desc'>";
               	   htm+="我的微博运动记录";
                   htm+="</div>";
                   $("#tb").html(htm);
                   $("#step_number").html(json.step_number);
                   $("#chang_currency").html(json.chang_currency);
			          //window.location.href="${ctx}/home/homePage";
			       }else{
			        if(json.code == 404 ){
	                    window.location.href=json.msg;
	               }else{
			             var msg="<p class='message'>"+json.msg+"</p>";
					       $("#qd-fail-sign").html(msg);
				           dialog(".qd-fail");
				           }
			       }
			    }
			    );
	}
	//截止倒计时
	function openshowtime() {	
	     var countdownStr=" 截至投票时间：";
            countdownStr+=open_day+"天";
        if (open_hour.toString().length == 1) {
            countdownStr+="0"+open_hour+"小时";
        }
        else {
            countdownStr+=open_hour+"小时";
        }
         if (open_minute.toString().length == 1) {
            countdownStr+="0"+open_minute+"分钟";
        }
        else {
            countdownStr+=open_minute+"分钟";
        }
         if (open_second.toString().length == 1) {
            countdownStr+="0"+open_second+"秒";
        }
        else {
            countdownStr+=open_second+"秒";
        }
        $("#count_down").html(countdownStr);
        open_second = open_second - 1;
        if (open_minute==0 && open_second <= 0) {
        		 clearInterval(closeshowtime);
			window.location.href="${ctx}/home/homePage";
		}
		else if(open_second<=0){
			 if (open_minute == 0) {
                open_second = 0;
            }
            else {
                open_minute = open_minute - 1;
                open_second = 59;
            }
		}
}
//兑换步数
		    function exchangeCurrency(){
		        statistics(); //cnzz统计
		        if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
			    $.post("${ctx}/home/exchangCurrency",{},function(json){
		       if(json.code == 0 ){
		       $("#myEnergyCurrency").html(json.myEnergyCurrency);
		       $("#step_number").html(json.surplus_step_number);
		       $("#chang_currency").html(0);
		           var htm="<p>获得";
		           var currency=json.energy_currency;
		           if(currency.length == 1){
		           htm+="<span>0</span>";
		           }
		           for(var i=0;i<currency.length;i++){
		            htm+="<span>"+currency.substring(i,i+1)+"</span>";
		           }
		           htm+="个活力币</p>";
		           $("#exchange-success-currency").html(htm);
		           dialog(".exchange-success"); 
		       }else{
		           var msg="<p class='message'>"+json.msg+"</p>";
		           $("#exchange-fail-currency").html(msg);
		           dialog(".exchange-fail");
		       }
	    }); 
	          }
	          //跳转到酷跑
	function forwardKp(){
	statistics(); //cnzz统计
	if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	   window.location.href="http://lbgj.fansiji.com/h5/Run/index.html?uid="+fromUser1+"&is_send=${is_send!}";
	   //window.location.href="http://api.fansiji.com/h5/Run/index.html?uid="+fromUser1+"&is_send=${is_send!}";
	}
	          //跳转到摇一摇
	function forwardShake(){
	statistics(); //cnzz统计
	if(fromUser1==null||fromUser1=="" || fromUser1==undefined ){
	 	window.location.href=oauthURL;
	 	return;
	 }
	   window.location.href="http://lbgj.fansiji.com/yyy/Shake/index.html?uid="+fromUser1+"&is_send=${yyy_is_send!}";
	   //window.location.href="http://api.fansiji.com/yyy/Shake/index.html?uid="+fromUser1+"&is_send=${yyy_is_send!}";
	}
	var offset = 0;
    var messagePlay = setInterval(function() {
  var ul_height = $(".msg ul").height();
  if (offset < ul_height - 40) {
    offset += 40;
  } else {
    offset = 0;
  }
  $(".msg ul").css({"transform": "translateY(-" + offset + "px)", "-webkit-transform": "translateY(-" + offset + "px)"});
}, 2000);
	
</script>
<script type="text/javascript" src="${ctx}/resource/js/modernizr-custom.js"></script>
<script type="text/javascript" src="${ctx}/resource/js/index.js?20160421"></script>
    <script type="text/javascript">
      if (!Modernizr.cssvhunit || !Modernizr.cssvwunit) {
        fixLayoutWithV()
      }

      function fixLayoutWithV() {
        var vw = $(window).width() / 100
        var vh = $(window).height() / 100

        var centerPaddingTop,
            exchangeBtnWidth,
            h2FontSize,
            h1FontSize;

        if ( (vw == 320 && vh == 480) || vh <= 600 ) {
          centerPaddingTop = 6 * vh;
          exchangeBtnWidth = 32 * vw;
          h2FontSize = 6 * vw;
          h1FontSize = 9 * vw;

          $(".center").css({paddingTop: centerPaddingTop + "px"});
          $("img.exchange_btn").width(exchangeBtnWidth);
          $(".center h2").css({fontSize: h2FontSize + "px"})
          $(".center h1").css({fontSize: h1FontSize + "px"})
        }
      }
         </script>
         <div style="display:none;">
<script src="http://s11.cnzz.com/z_stat.php?id=1258481327&web_id=1258481327" language="JavaScript"></script>
</div>
</html>
